# -*- coding: utf-8 -*-#
#-------------------------------------------------------------------------------
# 建立者:        黄周云  
# Name:         test10
# Description:  例23.10
# Author:       ASUS
# Date:         2019/4/7
#-------------------------------------------------------------------------------

from numpy import *
a = arange(20)
print(a)
#将数组保存成文本文件
savetxt("a.txt",a,fmt="%d")
savetxt("b.txt",a,fmt="%.2f")
#从文件中读取数据，以数组形式返回
aa = loadtxt("a.txt",dtype="int")
bb = loadtxt("b.txt",dtype="float")
print(aa)
print(bb)

x = arange(16).reshape(4,4)
print(x)
savetxt("x.txt",x,fmt="%d")
y = loadtxt("x.txt",dtype="int")
print(y)

